'use strict';

/**
 * @ngdoc function
 * @name interviewDemoApp.controller:LoginCtrl
 * @description
 * # LoginCtrl
 * Controller of the interviewDemoApp
 */
angular.module('interviewDemoApp')
  .controller('LoginCtrl', ['$scope','$state','$http',function ($scope,$state,$http) {
    $scope.user = '';
    $scope.password = '';
  	$scope.submit = function(){
      $http({
        url:'http://localhost:3000/session',
        method:'post',
        params:{'user':$scope.user,'password':$scope.password}
      }).success(function(data,header,config,status){
        if(data.status === 1){
          $state.go('resrume');
        }else{
          alert(data.message);
        }
      }).error(function(data,header,config,status){
        //处理响应失败
      });

    }
  }]);
